package main

import (
	"boke/blogpb"
	"context"
	"fmt"
	"google.golang.org/grpc"
)

// 发起 删除blog请求
func delete(cc *grpc.ClientConn, blogid int64) (b int64, err error) {
	// read Blog
	fmt.Println("删除请求 blog delete the blog")
	c := blogpb.NewBlogServiceClient(cc)

	deleteRes, deleteErr := c.DeleteBlog(context.Background(), &blogpb.DeleteBlogRequest{BlogId: blogid})
	b = deleteRes.BlogId
	if deleteErr != nil {
		fmt.Printf("删除出错 Error happened while deleting: %v \n", deleteErr)
	}
	fmt.Printf("删除成功 Blog was deleted: %v \n", b)

	return
}
